package com.pai4j.aigc.llm.repository.dao;

import com.pai4j.aigc.llm.entity.LLMModelEntity;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Optional;

@Repository
public interface ILLMModelDAO extends JpaSpecificationExecutor<LLMModelEntity>, JpaRepository<LLMModelEntity, Long> {

    Optional<LLMModelEntity> findByTenantIdAndCode(String tenantId, String code);

    List<LLMModelEntity> findByTenantIdAndStatus(String tenantId, Integer status);

    Optional<LLMModelEntity> findFirstByTenantIdAndIsDefaultAndStatus(String tenantId, Integer isDefault, Integer status);

    /**
     * Find model by globally unique code, regardless of tenant.
     */
    Optional<LLMModelEntity> findByCode(String code);
}
